<%@ page import="edcom.server.*" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.PreparedStatement" %>
<%@ page import="java.sql.SQLException" %>
<%@ page import="java.sql.ResultSet" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    
    <head>
        <title>edcom rules</title>
		<link rel="stylesheet" href="standard.css" type="text/css" />
        <script language="javascript" src="edcom.Base/edcom.Base.nocache.js"></script>
    </head>
    
	<body>

		<div id = "banner_top"><center><img src="images/bannertest9.png" id="bannerimg"></center></div>
		
		<div id="content">
		<div id="content_resize">
		
			<div class="sidebar">
			
				<div id = "login_space">
					<div class="t"><div class="b"><div class="l"><div class="r"><div class="bl"><div class="br"><div class="tl"><div class="tr">
					<div id="logBox" style=""></div>
					</div></div></div></div></div></div></div></div>
				</div>
				
				<div id = "sitemap_space">
					<div class="t"><div class="b"><div class="l"><div class="r"><div class="bl"><div class="br"><div class="tl"><div class="tr">
					<div id="sites" style="">
<%@ include file="sitemap_contents.html" %>
					</div>
					</div></div></div></div></div></div></div></div>
				</div>
				
				<div id = "link_space">
					<div class="t"><div class="b"><div class="l"><div class="r"><div class="bl"><div class="br"><div class="tl"><div class="tr">
					<div id="links" style="">
<%@ include file="links_contents.html" %>
					</div>
					</div></div></div></div></div></div></div></div>
				</div>
			
			</div>
			
			<div id = "general">
				<div class="article">
					<hr/>
					<h1>File Upload: demo</h1>
					<hr/>
<%
try {
	String connectionURL = "jdbc:mysql://localhost:3306/edcom"; // default mysql port is 3306
	Connection connection = null;
	Class.forName("com.mysql.jdbc.Driver").newInstance();
	connection = DriverManager.getConnection(connectionURL, "root", "durendal");
	if(!connection.isClosed()){
		ResultSet rs = null;
		PreparedStatement pstmt = connection.prepareStatement("SELECT * FROM filetable");
	    rs = pstmt.executeQuery();
		
	    out.println("<table border= '1'>");
	    
	    out.println("<tr><td> id </td> <td>course</td> <td>exernum</td> <td>title</td> <td>extension</td>");
	    
		while (rs.next()) {
			out.println("<tr>");
			out.print("<td>" + rs.getString(1) + "</td>" + "<td>" + rs.getString(2) + 
					"</td>" + "<td>" + rs.getString(3) + "</td>" + "<td>" + rs.getString(4) + 
					"</td>" + "<td>" + rs.getString(5) + "</td>" );
			out.println("</tr>");
		}
				
		out.println("</table>");
	}
} catch (ClassNotFoundException cnfe) {
	cnfe.printStackTrace();
	out.println("CNFE: " + cnfe.getMessage());
} catch (SQLException sqle) {
	sqle.printStackTrace();
	out.println("SQLE: " + sqle.getMessage());
}
%>


					<br>
					<br/>
					<hr/>
					<br/>
					<div id = "fileUploadArea"></div>
				</div>
			
			</div>
			
		</div>
		</div>
	
		<div id = "banner_bottom">
			<center>
<%@ include file="banner_bottom_contents.html" %>
			</center>
		</div>   

	<div id="clr"></div>

	</body>

</html>